import static org.junit.Assert.*;

import org.junit.Test;


public class BiddingModelTest {
	
	BiddingModel bid = new BiddingModel();

	
	 @Test
     public void WhenAllin_ExpectZeroZetonow() {
             Player o= new Human(1, "Marcin",1000);
             Player p= new Human(2, "Klaudia",500);
         
             bid.allin(o);
             bid.allin(p);
             assertEquals(o.zetony,0);
             assertEquals(p.zetony, 0);
             assertEquals(bid.allin, true);
             assertEquals(bid.najwyzsza,1000);
             
     }

     @Test
     public void WhenFold_ExceptFalseCzyGra() {
    	 Player o= new Human(1, "Marcin",1000);
         Player p= new Human(2, "Klaudia",500);
     
         bid.fold(o);
         assertEquals(o.czygra,false);
         assertEquals(p.czygra, true);
     }

     @Test
     public void WhenCall_ExceptIleWydaneLikeNajwyzsza() {
    	 Player o= new Human(1, "Marcin",1000);
         Player p= new Human(2, "Klaudia",500);
     
         bid.najwyzsza=100;
         bid.call(o);
         bid.call(p);
         assertEquals(o.ilewydane,bid.najwyzsza);
         assertEquals(p.ilewydane, bid.najwyzsza);
     }
     @Test
     public void WhenRaise_ExceptIleWydanePlusStawkaLikeNajwyzsza() {
    	 Player o= new Human(1, "Marcin",1000);
         Player p= new Human(2, "Klaudia",500);
     
         bid.najwyzsza=100;
         bid.raise(20,o);
         bid.raise(10,p);
         assertEquals(o.ilewydane,120);
         assertEquals(p.ilewydane, 130);
     }
     @Test
     public void WhenLicytacja_ExceptZetonyWPuli() {
    	 Player o= new Human(1, "Marcin",1000);
         Player p= new Human(2, "Klaudia",500);
     
         assertEquals(bid.pula,0);
         bid.bet(20,o);
         assertEquals(bid.pula,20);
         bid.raise(10,p);
         assertEquals(bid.pula, 50);
         bid.call(o);
         assertEquals(bid.pula, 60);
         assertEquals(bid.najwyzsza,30);
     }
     @Test
     public void WhenBet_ExceptJestStawkaLikeTrue() {
    	 Player o= new Human(1, "Marcin",1000);
         
         assertEquals(bid.jeststawka,false);
         bid.bet(20,o);
         assertEquals(bid.pula,20);
         assertEquals(bid.najwyzsza,20);
         assertEquals(bid.jeststawka, true);
     }
     
     public void WhenCheck_ExceptNothing() {
    	 Player o= new Human(1, "Marcin",1000);
    	 Player p= new Human(2, "Klaudia",500);
    	 
         assertEquals(bid.jeststawka,false);
         assertEquals(bid.allin,false);
         assertEquals(bid.pula,0);
         assertEquals(bid.najwyzsza,0);
         bid.check(o);
         bid.check(p);
         assertEquals(bid.jeststawka, false);
         assertEquals(bid.allin,false);
         assertEquals(bid.pula,0);
         assertEquals(bid.najwyzsza,0);
     }
}
